<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input type="text" id="wages">
  <button id="btn">计算</button>
  <input type="text" id="result">
</body>
<script src="./0813.js"></script>
<script>
  // 一个新入职，月工资为2000元的员工，每年涨当年工资5 %，到退休20年时的月工资是多少？
  // (原题) => getSalaryAfter(Salary) 封装 输入工资 返回对应20年后的工资.
  var wagesInp = document.querySelector('#wages')
  var btn = document.querySelector('#btn')
  var resultInp = document.querySelector('#result')
  btn.onclick = function () {
    var Salary = wagesInp.value * 1;
    var result = fn(Salary);
    // console.log(Salary, resultInp);
  }
  // var Salary = parseInt(prompt());
  function fn(Salary) {
    for (i = 1; i <= 20; i++) {
      Salary += Salary * 0.05;
    }
    console.log(Salary);
    resultInp.value = parseInt(Salary);
    // return true;
  }
  // fn(Salary);




</script>

</html>